package LinkedList.单链表;

/**
 * 测试
 */

import LinkedList.单链表.MyLinkedList;
import po.Person;

public class MyLinkedListTest {
    public static void main(String[] args) throws Exception {
        MyLinkedList<Person> list = new MyLinkedList<Person>();
        Person person = new Person(1,"22",1);
        Person person2 = new Person(2,"22",1);
        Person person3 = new Person(3,"22",1);
        Person person4 = new Person(4,"22",1);
        list.addLast(person);
        list.addLast(person2);
        list.addLast(person4);
        list.addLast(person3);
        list.display();
        System.out.println("==");
        list.reverseListAndPrint3(list.getHead());
        System.out.println("size"+list.getSize());
        System.out.println("firse"+list.getFirst());
        System.out.println("last"+list.getLast());

        System.out.println("000000000000000000000000000000");
        // first element i.e.10 should be printed


        // element at 3rd index i.e.40 should be printed

        //System.out.println(list.getAt(3));

        // a memory address of a node should be printed

        System.out.println(list.getNodeAt(3));

        // 10 should be removed and printed

        System.out.println(list.removeFirst());

        // 40 should be removed and printed

        System.out.println(list.removeLast());

        // list without 10 and 40 should be printed

        list.display();

        // 100 should be added at first


        list.display();

        // 30 should be removed

        list.removeAt(2);

        // 300 should be added at 2nd index

        list.display();
        System.out.println(list.getSize());
        list.removeAll();
        System.out.println(list.getSize());

    }
}
